<template>
	<view class="detail-page">
		<view class="wrap">
			<u-swiper :list="weaperList" height="500" img-mode="aspectFit"></u-swiper>
		</view>
		<view class="detail-box">
			<view class="price u-flex yu-between">
				<view class="">
					<text class="yu-color-money">￥<text class="u-font-40">{{dataInfo.newprice}}</text></text>
					<text class="yu-color-9 u-p-l-20">￥<text style="text-decoration: line-through;">{{dataInfo.oldprice}}</text></text>
				</view>
				
				<text class="yu-color-9 u-p-l-20">库存：{{dataInfo.kucun}}</text>
			</view>
			<view class="active">
				<view class="u-font-36 yu-bold yu-color-3 u-p-b-20 u-p-t-20">{{dataInfo.productname}}</view>
				<view class="u-font-32 title yu-color-6 yu-flex-1 u-p-t-20 u-p-b-20">{{dataInfo.productinfo}}</view>
				<view class="time u-text-right yu-color-9">
					{{dataInfo.updatetime}}
				</view>
			</view>
			<u-divider color="#333" half-width="100%" fontSize="32">详情</u-divider>
			<view class="xiangqing u-p-t-20 u-p-b-80">
				<u-image width="100%" mode="widthFix" :src="dataInfo.imgdetail ? baseUrl + dataInfo.imgdetail : baseUrl + 'product/imgdetails.png'" >
				</u-image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseUrl: this.$api.json('baseUrl')+'/upload/',
				dataInfo:{},
			}
		},
		onLoad() {
			this.dataInfo = JSON.parse(sessionStorage.getItem('product'))
		},
		computed:{
			weaperList(){
				const {img1, img2, img3} = this.dataInfo
	
				return [
					{image: img1 ? this.baseUrl + img1 : 'https://cdn.uviewui.com/uview/swiper/1.jpg'},
					{image: img2 ? this.baseUrl + img2 : 'https://cdn.uviewui.com/uview/swiper/2.jpg' },
					{image: img3 ? this.baseUrl + img3 : 'https://cdn.uviewui.com/uview/swiper/3.jpg'}
				]
			}
		},
		methods: {

		}
	}
</script>

<style lang="less">
	.detail-page{
		.detail-box{
			padding: 20rpx;
			background-color: #fff;
			border-radius: 12rpx;
		}
	}
</style>
